from rest_framework import serializers
from .models import Area

#1,最高行政区域,序列化器
class AreaSerializer(serializers.ModelSerializer):
    class Meta:
        model = Area
        fields = ("id","name")


#2,最高行政区域,和附属行政区域,序列化器
class AreaSubsSerializer(serializers.ModelSerializer):
    subs = AreaSerializer(read_only=True, many=True)
    class Meta:
        model = Area
        fields = ("id","name","subs")

